package cn.tuling;

import cn.tuling.service.OrderService;
import cn.tuling.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        testEnable(context);
    }

    public static void testProxy12(AnnotationConfigApplicationContext context) {
        UserService userService = ((UserService) context.getBean("userServiceProxy1"));
        userService.test();
    }

    public static void testProxy3(AnnotationConfigApplicationContext context) {
        UserService userService = ((UserService) context.getBean("userService"));
        userService.test();
    }

    public static void testAuto(AnnotationConfigApplicationContext context) {
        UserService userService = ((UserService) context.getBean("userService"));
        userService.test();
        userService.testABC();

        OrderService orderService = (OrderService) context.getBean("orderServiceImpl");
        orderService.test();
    }

    public static void testEnable(AnnotationConfigApplicationContext context) {
        UserService userService = ((UserService) context.getBean("userService"));
        userService.test();
        userService.testABC();
    }
}
